<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>

<?php
include("session.php");
include("Conexao.php");

$conexao = new Conexao();

$con = $conexao->conectBD();


$sql = "SELECT * FROM tbfabricante_equipe05";


$result = pg_query($sql);
$id = $_GET["id"];

if($id){
    
   
            $result = pg_prepare($con, "my_query", 'DELETE FROM tbfabricante_equipe05 WHERE codigo = $1');

            $result = pg_execute($con, "my_query", array($id));

        
            
   echo "<meta HTTP-EQUIV='Refresh' CONTENT='0;URL=indexAdmin.php?link=4'>";
}

else {

?>

<script language="Javascript">
function confirmacao(id) {
     var resposta = confirm("Deseja remover esse registro?");
 
     if (resposta == true) {
          window.location.href = "indexAdmin.php?link=4&id="+id;
          
          
     }
}
</script>



<html>
    <head>
         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <LINK REL=StyleSheet HREF="main.css" TYPE="text/css" MEDIA=screen>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>   
    <link rel="stylesheet" href="main.css" />
        <title></title>
    </head>
    <body>
     <table border="0" width="100%" align="center" style="border: 1px solid #ccc;">
            <thead>
                <tr align="center" style="border: 1px solid #ccc;">
                    <td align="center" ><strong>Fabricante</strong></td>
                    <td align="center" colspan="3"> <strong>País</strong></td>
                </tr>
            </thead>
            <tbody>
                <?php while ($colum = pg_fetch_array($result)) { ?>  
                <tr style="border: 1px solid #ccc;">
                    <td align="center" style="border: 1px solid #ccc;">
                      <?php echo $colum["nome"]; ?>  
                    </td>
                 
                    <td align="center" style="border: 1px solid #ccc;">
                      <?php echo $colum["pais"]; ?>  
                    </td>
        
                    
                    
                    
                   
                <td align="center" width="20" style="border: 1px solid #ccc;"><a href="javascript:func()" onclick="confirmacao('<? echo $colum["codigo"]?>')"><img src="images/cancel_48.png" width="15" height="15" alt="cancel_48"/></a></td>    
                </tr>
                 <?php } $conexao->desconectBD(); ?>
                <tr>
                    <td></td>
                    <td colspan="3" align="right"><a href="indexAdmin.php?link=10"> INSERIR <img src="images/add_48.png" width="20" height="20" alt="add_48"/> </a></td>
                    
                </tr>
            </tbody>
           
            
        </table>
    </body>
    <?}?>
</html>
